*, *:before, *:after {
  border: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-size: 16px;
}

body {
  background: #126;
  display: flex;
  height: 100vh;
  overflow-x: hidden;
}

.lighthouse {
  margin:10px 5px 15px 20px;
  position: relative;
  width: 16.4em;
  height: 31.2em;
  perspective: 30em;
}

.lighthouse div {
  position: absolute;
}

.shadow {
  background: rgba(0, 0, 10, 0.15);
  width: 20%;
  height: 100%;
  z-index: 1;
}

.light-ray {
  animation: lightRay 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: linear-gradient(90deg, #ffff5c, rgba(255, 255, 92, 0));
  top: 3.3em;
  left: 8em;
  width: 14em;
  height: 1.5em;
  transform-origin: 0% 50%;
  z-index: 6;
}

.roof-tip {
  background: #464646;
  border-radius: 50%;
  left: 7.5em;
  width: 1em;
  height: 1em;
  z-index: 1;
}

.roof {
  background: linear-gradient(-30deg, #5a5a5a 59%, rgba(90, 90, 90, 0) 60%) 0 0/50.5% 100%, linear-gradient(30deg, #5a5a5a 59%, rgba(90, 90, 90, 0) 60%) 99.5% 0/50.5% 100%;
  background-repeat: no-repeat;
  border-radius: 0 0 10% 10%;
  top: 0.9em;
  left: 5.25em;
  width: 5.5em;
  height: 2em;
}

.head, .window1, .window2 {
  background: #dcdcdf;
}

.head, .upper-neck, .lower-neck, .stem, .base-bottom {
  overflow: hidden;
}

.head {
  border-radius: 50% 50% 0 0 / 20% 20% 0 0;
  top: 2.2em;
  left: 5.6em;
  width: 4.8em;
  height: 4em;
}

.light {
  animation: light 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: #ffff5c;
  border-radius: 50%;
  top: 0.6em;
  left: 1.4em;
  width: 2em;
  height: 2em;
}

.top-rail, .bottom-rail {
  color: #8c8c96;
}

.top-rail {
  border-radius: 50% 50% 0 0;
  box-shadow: 0 0 0 0.2em inset;
  top: 5em;
  left: 5.1em;
  width: 5.7em;
  height: 1.5em;
  z-index: 1;
}

.upper-neck {
  background: #5a5a5a;
  border-radius: 50% 50% 0 0 / 35% 35% 0 0;
  top: 5.7em;
  left: 5em;
  width: 6em;
  height: 2.2em;
  z-index: 2;
}

.bottom-rail {
  border-radius: 50%;
  box-shadow: 0 0 0 0.2em inset;
  top: 6.3em;
  left: 4.2em;
  width: 7.6em;
  height: 2em;
  z-index: 4;
}

.lower-neck {
  background: #464646;
  border-radius: 50% 50% 50% 50% / 25% 25% 50% 50%;
  top: 7.6em;
  left: 4em;
  width: 8em;
  height: 2.5em;
  z-index: 5;
}

.stem {
  border-radius: 50% 50% 50% 50% / 5% 5% 2% 2%;
  box-shadow: 2em 0 0 0 #000 inset;
  bottom: 1.7em;
  left: 3.4em;
  height: 27.3em;
  width: 9.2em;
  transform: rotateX(30deg);
  transform-origin: 50% 100%;
  z-index: 6;
}

.window1, .window2, .door {
  z-index: 1;
}

.window1, .window2 {
  animation: windows 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  border-radius: 50%;
  left: 3.7em;
  width: 2.5em;
  height: 2.5em;
}

.window1 {
  box-shadow: 0 0.3em 0 0 #a7a7ae inset;
  top: 3.5em;
}

.window2 {
  box-shadow: 0 0.2em 0 0 #9f0000 inset;
  top: 10em;
}

.door {
  animation: door 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: #222;
  border-radius: 1em 1em 0 0;
  box-shadow: -0.3em 0 0 0 #9f0000 inset;
  top: 23.5em;
  left: 6em;
  height: 4em;
  width: 2em;
}

.stem-texture {
  animation: texture 3s 0s cubic-bezier(0.8, 0.2, 0.2, 0.8) infinite running;
  background: radial-gradient(13em 5.9em at 100% 28.9em, white 49.9%, rgba(255, 255, 255, 0) 50%) 0 0/8em 100%, radial-gradient(21em 14.8em at 100% 100%, #d20000 49.9%, rgba(210, 0, 0, 0) 50%) 0 0/8em 100%, radial-gradient(27em 26.7em at 100% 100%, white 49.9%, rgba(255, 255, 255, 0) 50%) 0 0/8em 100%, radial-gradient(35em 38.9em at 100% 100%, #d20000 49.9%, rgba(210, 0, 0, 0) 50%) 0 0/8em 100%, radial-gradient(39em 50.8em at 100% 100%, white 49.9%, #d20000 50%) 0 0/8em 100%, linear-gradient(180deg, #d20000 2em, white 2em, white 8em, #d20000 8em, #d20000 14em, white 14em, white 20em, #d20000 20em, #d20000 26em, white 26em) 8em 0/4em 100%, radial-gradient(6em 3.9em at 0 0, #d20000 49.9%, rgba(210, 0, 0, 0) 50%) 12em 0/8em 100%, radial-gradient(13em 15.8em at 0 0, white 49.9%, rgba(255, 255, 255, 0) 50%) 12em 0/8em 100%, radial-gradient(18em 27.9em at 0 0, #d20000 49.9%, rgba(210, 0, 0, 0) 50%) 12em 0/8em 100%, radial-gradient(18em 39.9em at 0 0, white 49.9%, rgba(255, 255, 255, 0) 50%) 12em 0/8em 100%, radial-gradient(18em 51.9em at 0 0, #d20000 49.9%, white 50%) 12em 0/8em 100%;
  background-repeat: no-repeat;
  width: 14em;
  height: 100%;
}

.base-top, .base-bottom {
  width: 16.4em;
}

.base-top {
  background: #8c8c96;
  border-radius: 50%;
  top: 27.2em;
  height: 2.8em;
  z-index: 1;
}

.base-bottom {
  background: #72727d;
  border-radius: 0 0 50% 50%;
  top: 28.5em;
  height: 2.6em;
  z-index: 0;
}

@keyframes lightRay {
  from, to {
    transform: rotateY(0deg) translate(2.4em, 0) rotateX(0deg) translateZ(0);
  }
  50% {
    transform: rotateY(-90deg) translate(2.2em, 0.3em) rotateX(-90deg) translateZ(0.5em);
  }
}
@keyframes light {
  from, to {
    transform: translate(2.8em, 0.3em) scaleX(0);
  }
  50% {
    transform: translate(0, 0) scaleX(1);
  }
}
@keyframes windows {
  from, to {
    transform: translateX(4.5em) scale(0, 1.2);
  }
  50% {
    transform: translateX(0) scale(1, 1.2);
  }
}
@keyframes door {
  from, to {
    transform: translateX(2.8em) scaleX(0);
  }
  50% {
    transform: translateX(0) scaleX(1);
  }
}
@keyframes texture {
  from, to {
    transform: translateX(0);
  }
  50% {
    transform: translateX(-34.3%);
  }
}
